<div id="role-setting-view">
  <div class="pageheader">
    <h2><i class="fa fa-home"></i>权限编辑</h2>
    <div class="al-header-right">
      <button type="button" class="btn btn-primary" ng-click="saveSetting()">保存</button>
      <button type="button" class="btn btn-default" ng-click="resetAuthority()">重置</button>
    </div>
  </div>
  <div class="page">
    <div class="al-list-container">
      <form name="modalForm" class="form-horizontal al-search-container" role="form">
        <div class="form-group">
          <label class="col-sm-3 control-label">权限名称<span class="attr-need">*</span></label>
          <div class="col-sm-6">
            <input class="form-control" ng-model="data.authority" type="text"
                   ng-required="true" name="authorityName"
                   placeholder="" maxlength="50"/>
            <div class="help-block with-errors"
                 ng-if="modalForm.authorityName.$invalid && !modalForm.authorityName.$pristine">
              权限名称不可为空
            </div>
          </div>
        </div>
        <div class="form-group">
          <label class="col-sm-3 control-label">描述</label>
          <div class="col-sm-6">
            <textarea cols="5" ng-model="data.description"
                      class="form-control" maxlength="500" placeholder="描述"></textarea>
          </div>
        </div>
        <div class="form-group">
          <label class="col-sm-3 control-label">类型</label>
          <div class="col-sm-6">
                    <span class="ui-select">
                        <select ng-model="data.type"
                                ng-options="option.value as option.name for option in typeList"></select>
                    </span>
          </div>
        </div>
        <div class="form-group">
          <label class="col-sm-3 control-label">状态</label>
          <div class="col-sm-6">
            <nobr>
              <label class="ui-radio" ng-repeat="option in enabledList">
                <input name="enabled" ng-value="option.value" type="radio" ng-model="data.enabled">
                <span>{{option.name}}</span>
              </label>
            </nobr>
          </div>
        </div>
      </form>
      <div class="al-no-data" ng-show="tableData.length==0">
        尚未绑定资源<br>
        <button class="btn btn-primary" ng-click="bindResource()">绑定资源</button>
      </div>
      <table ng-table="tableParams" ng-show="tableData.length>0"
             class="table  table-bordered table-striped table-condensed al-table-container">
        <caption>
          <button style="float:right;" class="btn btn-primary" ng-click="bindResource()">绑定资源</button>
        </caption>
        <thead>
        <tr>
          <td>名称</td>
          <td>描述</td>
          <td>类型</td>
          <td>状态</td>
          <td>操作</td>
        </tr>
        </thead>
        <tbody>
        <tr ng-repeat="item in $data">
          <td>{{item.resource}}</td>
          <td>{{item.description}}</td>
          <td>{{item.type|constantTransfer:resourceTypeList}}</td>
          <td>{{item.enabled|constantTransfer:enabledList}}</td>
          <td>
            <button class="btn btn-warning btn-sm al-fl-rt"
                    ng-confirm-click="确定要执行删除操作吗？"
                    ng-click="removeResource(item)">移出
            </button>
          </td>
        </tr>
        </tbody>
      </table>
    </div>
  </div>
</div>
